public class AbsoluteValue {
/**
 * 利用方法重载，编写三个重载方法，分别求出int类型绝对值，float类型绝对值和double类型绝对值。
 */
public int absolute(int a){

    int result = 0;
    if(a > 0){
        result = a;
    }
    if(a < 0){
        result = -a;
    }
    return result;
}

    public float absolute(float a){

        float result = 0.0f;
        if(a > 0){
            result = a;
        }
        if(a < 0){
            result = -a;
        }
        return result;
    }

    public double absolute(double a){

        double result = 0.0d;
        if(a > 0){
            result = a;
        }
        if(a < 0){
            result = -a;
        }
        return result;
    }

    public static void main(String[] args) {
        AbsoluteValue obj = new AbsoluteValue();
        System.out.println("int类型绝对值为：" + obj.absolute(-3));
        System.out.println("float类型绝对值为：" + obj.absolute(-3.3f));
        System.out.println("double类型绝对值为：" + obj.absolute(-3.3d));
    }
}
